# 2 times installation
# reference CDS_Installation.sh
# reference CDS Performance environment setup
# on local server, 10.8.1.200
#

export CDS_BASE=/cds/workspace
export CDS_HOME=$CDS_BASE/mysqlprototype
export CDS_TOOLS=$CDS_BASE/dependencies
export PATH=$CDS_HOME/bin:$CDS_HOME/modules/internal/perftest/src/scripts/cdsadmin/:$CDS_HOME/tools:$CDS_TOOLS/tools:$PATH
JAVA_HOME=/cds/jdk1.5.0_11/; export JAVA_HOME
PATH=.:${CDS_HOME}/bin:${JAVA_HOME}/bin:${PATH}; export PATH


cd $CDS_BASE
unzip /cds/downloads/mysqlprototype.zip
unzip /cds/downloads/dependencies.zip
ls
cfg/                   internalperftest.zip   release/
dependencies/          mysqlprototype/        trunk/

cdst buildall
# find difference between mysqlprototype and trunk

cat > $CDS_HOME/bin/init_env.sh <<EOF
export BEA_HOME=/pkgs/weblogic921
export WL_HOME=/pkgs/weblogic921/weblogic92
export SUN_AS_HOME=/cds/SUNWappserver

export JAVA_HOME=/cds/jdk1.5.0_11/
export DEFAULT_DEPL=cds
export DEFAULT_CONFIG=sn_sample.cfg
export DEFAULT_DB=DBConf.xml
export DEFAULT_SYS_USER=DBSysUser.xml
EOF

# DON NOT Change DBConf.xml
# may setting mysql root password
cat > $CDS_HOME/cfg/DBSysUser.xml <<EOF
<DBUsers>

    <DBServer name="DBServer1">
        <User>root</User>
        <Password>q1w2e3</Password>
    </DBServer>

</DBUsers>
EOF

cp $CDS_HOME/cfg/DBSysUser.xml $CDS_HOME/deployment/cds/
cp $CDS_HOME/cfg/DBConf.xml $CDS_HOME/deployment/cds/

export HOSTNAME=`hostname`
export PORT_NO=3080
cat > $CDS_HOME/cfg/sn_sample.cfg <<EOF
######################################################################
#
# Configuration File
#
# This Java properties file defines all of the required properties
# that are used to deploy and configure a server. Your deployment
# can consist of any combination of the following components:
#
# CATALOG MANAGER         (cs)
# DEVELOPER PORTAL        (dp)
# VENDING MANAGER         (vs)
# SUBSCRIBER PORTAL       (sp)
# FULFILLMENT MANAGER     (fs)
# EVENT SERVICE           (es)
# MESSAGING SERVICE       (ms)
# NOTIFY SERVICE          (ns)
# POSTPAID SERVICE        (pps)
# MONITORING SERVICE      (mos)
# CATALOG SEARCH SERVICE  (css)
# VENDING SEARCH SERVICE  (vss)
#
# NOTE: Be careful not to leave trailing spaces.....
#
######################################################################

#=====================================================================
# General Properties
#=====================================================================

# Specifies your application server to be Sun Java System (DO NOT CHANGE)
server.type=sun

# ------------ Java Settings ------------- #
java.mem=-Xms512m -Xmx1024m -XX:MaxPermSize=256m

# --------- App Server Settings ---------- #
app.server.domain=cdsdomain
app.server.name=cdsserver
app.server.portnumber=$PORT_NO
app.server.ssl.port=`expr $PORT_NO + 1`

# --------- JNDI Server Settings --------- #
# Specifies the JNDI factory (DO NOT CHANGE)
jndi.factory=com.sun.jndi.fscontext.RefFSContextFactory
# Specifies the JNDI URL (DO NOT CHANGE)
jndi.url=file://[[deployment]]/sun

# ------------- URI Settings ------------- #
cs.internal.uri=http://$HOSTNAME:$PORT_NO/admin/
dp.internal.uri=http://$HOSTNAME:$PORT_NO/developer/
fs.internal.uri=http://$HOSTNAME:$PORT_NO/fs/
vs.internal.uri=http://$HOSTNAME:$PORT_NO/vsadmin/
sp.internal.uri=http://$HOSTNAME:$PORT_NO/subscriber/
es.internal.uri=http://$HOSTNAME:$PORT_NO/es/
ms.internal.uri=http://$HOSTNAME:$PORT_NO/ms/
ns.internal.uri=http://$HOSTNAME:$PORT_NO/ns/
pps.internal.uri=http://$HOSTNAME:$PORT_NO/pps/
mos.internal.uri=http://$HOSTNAME:$PORT_NO/mos/
css.internal.uri=http://$HOSTNAME:$PORT_NO/css/
vss.internal.uri=http://$HOSTNAME:$PORT_NO/vss/

cs.external.uri=http://$HOSTNAME:$PORT_NO/admin/
dp.external.uri=http://$HOSTNAME:$PORT_NO/developer/
fs.external.uri=http://$HOSTNAME:$PORT_NO/fs/
vs.external.uri=http://$HOSTNAME:$PORT_NO/vsadmin/
sp.external.uri=http://$HOSTNAME:$PORT_NO/subscriber/

# ----------- Vending Settings ----------- #
vs.account.name=cds.vending.server.1
vs.account.password=vending

# ------------ Mail Settings ------------- #
ms.mail.smtp.host=localhost
ms.mail.smtp.sender=root@$HOSTNAME

#=====================================================================
# Included Managers, Portals, & Services
#=====================================================================
# Make any of the following lines a comment if the manager, portal, or service should not be deployed
cs.include
dp.include
vs.include
sp.include
fs.include
es.include
ms.include
ns.include
pps.include
mos.include
css.include
vss.include
EOF

# modify DBConf.xml, DBSysUser.xml
cd $CDS_TOOLS/external/
gunzip -c /cds/downloads/mysql-connector-java-5.1.7.tar.gz | tar xvf -
mkdir -p mysql/lib
cp mysql-connector-java-5.1.7/mysql-connector-java-5.1.7-bin.jar mysql/lib

cd $CDS_HOME
sh dbinit
# cdsi db init
# should be replace by the dbinit script
# toubleshooting begin
tree() { for i in $1; do if [ -d $i ]; then echo $i; done }
cd /cds/workspace/mysqlprototype; tree "*/*" > /tmp/mysqlprototype.dir
cd /cds/workspace/trunk; tree "*/*" > /tmp/trunk.dir
bash-3.00# diff /tmp/mysqlprototype.dir /tmp/trunk.dir
0a1
> bin/bea
2a4,5
> deployment/Sun_Java_System_Content_Delivery_Server_5.1_ga
> dist/cds
21a25
> modules/internal
23a28
> modules/perftest
33a39
> modules/unused
39,40c45,47
< mysql-connector-java-5.1.7/docs
< mysql-connector-java-5.1.7/src
---
> tests/jmeter
> tests/junit
> tools/codecheck

# checking the classpath
echo /cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/xml-apis.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/xercesImpl.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-weblogic.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-trax.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-testutil.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-swing.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-stylebook.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-starteam.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-nodeps.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-netrexx.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-launcher.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-junit.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-jsch.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-jmf.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-jdepend.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-javamail.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-jai.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-commons-net.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-commons-logging.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-apache-resolver.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-apache-regexp.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-apache-oro.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-apache-log4j.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-apache-bsf.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-apache-bcel.jar:/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-antlr.jar:/cds/workspace/mysqlprototype/dist/cds/localization:/cds/workspace/mysqlprototype/dist/cds/lib/cdslib/cdstools.jar:/cds/workspace/mysqlprototype/dist/cds/lib/cdslib/entity.jar:/cds/workspace/mysqlprototype/dist/cds/lib/cdslib/foundation.jar:/cds/workspace/mysqlprototype/dist/cds/lib/cdslib/cdsapi.jar:/cds/workspace/mysqlprototype/dist/cds/lib/external/jdom.jar:/cds/workspace/mysqlprototype/dist/cds/lib/external/mysql-connector-java-5.1.7-bin.jar:/cds/workspace/mysqlprototype/dist/cds/lib/external/jakarta-regexp-1.2.jar | tr ':' '\n' | xargs file
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/xml-apis.jar:    java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/xercesImpl.jar:  java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant.jar: java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-weblogic.jar:        java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-trax.jar:    java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-testutil.jar:        java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-swing.jar:   java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-stylebook.jar:       java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-starteam.jar:        java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-nodeps.jar:  java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-netrexx.jar: java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-launcher.jar:        java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-junit.jar:   java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-jsch.jar:    java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-jmf.jar:     java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-jdepend.jar: java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-javamail.jar:        java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-jai.jar:     java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-commons-net.jar:     java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-commons-logging.jar: java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-apache-resolver.jar: java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-apache-regexp.jar:   java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-apache-oro.jar:      java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-apache-log4j.jar:    java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-apache-bsf.jar:      java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-apache-bcel.jar:     java program
/cds/workspace/dependencies/tools/apache-ant-1.7.0/lib/ant-antlr.jar:   java program
/cds/workspace/mysqlprototype/dist/cds/localization:    directory
/cds/workspace/mysqlprototype/dist/cds/lib/cdslib/cdstools.jar: ZIP archive
/cds/workspace/mysqlprototype/dist/cds/lib/cdslib/entity.jar:   ZIP archive
/cds/workspace/mysqlprototype/dist/cds/lib/cdslib/foundation.jar:       ZIP archive
/cds/workspace/mysqlprototype/dist/cds/lib/cdslib/cdsapi.jar:   ZIP archive
/cds/workspace/mysqlprototype/dist/cds/lib/external/jdom.jar:   ZIP archive
/cds/workspace/mysqlprototype/dist/cds/lib/external/mysql-connector-java-5.1.7-bin.jar: java program
/cds/workspace/mysqlprototype/dist/cds/lib/external/jakarta-regexp-1.2.jar:     cannot open: No such file or directory

# toubleshooting end


# modify cfg/sn_sample.cfg
cdsi deploy
cd $CDS_HOME/deployment/cds/sun/applications/
deploymq.sh server
broker.sh start
deploy.sh create
# cdse startserver
admin.sh start


================================================================================
# 2cd installation

cd /cds/sjscds-ea
export CDS_HOME=`pwd`
export CDS_BASE=/cds/workspace
export CDS_TOOLS=$CDS_BASE/dependencies
export PATH=$CDS_HOME/bin:$CDS_HOME/modules/internal/perftest/src/scripts/cdsadmin/:$CDS_HOME/tools:$CDS_TOOLS/tools:$PATH
JAVA_HOME=/usr/jdk/instance/jdk1.6.0/; export JAVA_HOME
PATH=.:${CDS_HOME}/bin:${JAVA_HOME}/bin:${PATH}; export PATH
env | grep ^CDS
echo $PATH | tr ":" "\n"


cdst buildall
cdst build internal/perftest

# Please read it first in the morning. Jack Zou

/cds/workspace/mysqlperformance/deployment/Sun_Java_System_Content_Delivery_Server_5.1_ga/deployment/cds/sun/domains/cdsdomain/logs/server.log
/cds/workspace/mysqlperformance/deployment/Sun_Java_System_Content_Delivery_Server_5.1_ga/cfg/registry/cds/cds.log
